<template>
  <div class="box">
    <div id="" style="margin-bottom: 30px;">
      <el-button :type="type=='规范定义'?'primary':''" v-has @click="type='规范定义'">规范定义</el-button>
      <!-- <el-button :type="type=='规范查阅'?'primary':''" v-has @click="type='规范查阅'">规范查阅</el-button> -->
    </div>
    
    <template v-if="type=='规范定义'">
      <el-table :data="tableData1" border fit stripe highlight-current-row>
        <el-table-column v-for="item in tableHead1" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='oper1'">
              {{scope.row[item.title]}}
            </div>
            <div v-else>
              <el-button type="primary" size="mini">规范查阅</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <template v-if="type=='规范查阅'">
      <el-table :data="tableData2" border fit stripe highlight-current-row>
        <el-table-column v-for="item in tableHead2" :key="item.id" :label="item.label" :prop="item.title"
          align="center">
          <template v-slot="scope">
            <div v-if="item.title!='oper2'">
              {{scope.row[item.title]}}
            </div>
          </template>
        </el-table-column>
      </el-table>
    </template>
    
  </div>
</template>

<script>
  export default {
    data() {
      return {
        ruleForm: {},
        formData: {},
        ruleForm1: {},
        formData1: {},
        ruleForm2: {},
        formData2: {},
        fileList: [],
        type: '数据导入',
        tableHead1: [{
            id: 1,
            label: "步骤名称",
            title: "name",
          },
          {
            id: 2,
            label: "文件或目录",
            title: "dir",
          },
          {
            id: 3,
            label: "正则表达式",
            title: "regular",
          },
          {
            id: 4,
            label: "选中的文件",
            title: "selectDir",
          },
          {
            id: 5,
            label: "配置规则",
            title: "rule",
          }
        ],
        tableData1: [{
          name: "配置文件输入",
          dir: 'E:\ws',
          regular: '^([1-9][0-9]*)+(\.[0-9]{1,2})?$',
          selectDir: '配置文件1',
          rule: '驼峰命名',
          oper1: '发布'
        },
        {
          name: "配置文件输出",
          dir: 'D:\ME20190427130023',
          regular: '^\d{m,n}$',
          selectDir: '配置文件2',
          rule: '驼峰命名',
          oper1: '发布'
        }],
        
        formData: {},

        tableHead2: [{
            id: 1,
            label: "任务编号",
            title: "id",
          },
          {
            id: 2,
            label: "数据任务名称",
            title: "name",
          },
          {
            id: 3,
            label: "任务状态",
            title: "status",
          },
          {
            id: 4,
            label: "任务执行结果",
            title: "result",
          },
          {
            id: 5,
            label: "操作",
            title: "oper2",
          }
        ],
        tableData2: [{
          id: "1",
          name: '提取任务102',
          status: '已进行',
          result: '另存为->正在提取',
          oper2: '发布'
        }]
        
      };
    },
    computed: {
      uploadFile() {
        return process.env.VUE_APP_BASE_API + "/dc/importCustomer";
      },
      headers() {
        const head = {
          token: this.$store.getters.token,
        };
        return head;
      },
    },
    methods: {
      submitForm() {
        this.$message({
          type: "success",
          message: '上传目录成功'
        })
      },
      resetForm() {

      }
    }
  }
</script>

<style lang="scss" scoped>
  .box {
    padding: 30px;
  }
</style>
